package action.xtwh;

import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import services.xtwh.ZpscServices;
import com.syslog.SysLogServices;
import com.util.Component;
import com.util.Util;
/**
* PersonMgrFacade:照片上传action
* @author bjh
* @version Fri May 06 17:59:17 CST 2016 gjx
* @since 1.0
*/
@Controller
@RequestMapping("zpsc.do")
public class ZpscAction {
	ZpscServices ss = new ZpscServices();
	SysLogServices log = SysLogServices.getInstance();
	/**
	 * 性别下拉框选项
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getaac004")
	public void getSelectaac004(HttpServletRequest request, HttpServletResponse response) throws Exception {
		List data = ss.getSelect(Component.getQuest("lx", request));
		Component.print(Util.Encode(data), response);
	}	
	/**
	 * 民族下拉框选项
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getaac005")
	public void getSelectaac005(HttpServletRequest request, HttpServletResponse response) throws Exception {
		List data = ss.getSelect(Component.getQuest("lx", request));
		Component.print(Util.Encode(data), response);
	}	
	/**
	 * 查询个人制卡信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getgrunitdata")
	public void getgrunitdata(HttpServletRequest request, HttpServletResponse response) throws Exception {
		HashMap user = ss.getgrUnitData(Component.getQuest("id", request));
		String aae011 = Component.getSession("userid", request);
		HashMap obj = new HashMap();	
		if(user == null) {
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011); //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，人员社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "error");//输出参数
			log.sysLogMap(obj, request);
		} else {
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011); //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，人员社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "success");//输出参数
			log.sysLogMap(obj, request);
		}
		Component.print(Util.Encode(user), response);
	}	
	/**
	 * 删除照片信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=deletedata")
	public void deletedata(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String date = ss.deletedata(Component.getQuest("id", request));
		String aae011 = Component.getSession("userid", request);
		HashMap obj = new HashMap();	
		if(date.equals("1")) {
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm 
			obj.put("log_type", "T04");   //日志类别，见sys_log_bm
			obj.put("userid", aae011); //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "删除照片信息，人员社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "success");//输出参数
			log.sysLogMap(obj, request);
		} else {
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm
			obj.put("log_type", "T04");   //日志类别，见sys_log_bm
			obj.put("userid", aae011); //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，人员社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "success");//输出参数
			log.sysLogMap(obj, request);
		}
		Component.print(Util.Encode(date), response);
	}	
	/**
	 * 查询信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=checkgrzp")
	public void checkgrzp(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String id = Component.getQuest("id", request);
		String aae011 = Component.getSession("userid", request);
		String res = ss.check(id);
		HashMap obj = new HashMap();
		if(res.equals("0")) {						
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011); //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "此人照片采集已采集，社会保障卡号：" + id);
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", id); //输入参数
			obj.put("dataout", "success");//输出参数
			log.sysLogMap(obj, request);
			Component.print(Util.Encode(res), response);
		} else {
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011); //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "此人照片可以采集，社会保障卡号：" + id);
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", id); //输入参数
			obj.put("dataout", "success");//输出参数
			log.sysLogMap(obj, request);
			Component.print(Util.Encode(res), response);
		}
	}	
}
